package Model;

import JDBC.*;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class Prato {

    private int id;

	public void adicionarPrato(String Nome, String Descricao, int Preco){
        DBConnection DBConnection = new DBConnection(Constants.DB_NAME, Constants.USER, Constants.PASSWORD, false, null);

        String query = "INSERT INTO estabelecimento (id) values " + id;
        //RecordSet rs = databaseManager.returnResultSetSelectStatement();
        DBConnection.closeDatabase();
	}
	
	public void removerPrato(int id_prato){
        /*
        DBConection dbConection = new DBConection();

        String query = "DELETE FROM pratos where id = " + id_prato;

        dbConection.delete(query);
        */
    }

    // Modificado -- acrescentado
    public static String[] obterTiposPratos() {
        DBConnection dbConnection = new DBConnection(Constants.DB_NAME, Constants.USER, Constants.PASSWORD, false, null);

        JDBC.DBConnection.ConnectionHandler ch = DBConnection.getConnectionHandlerInstance();
        String sql = "SELECT * FROM tipoDePrato";
        dbConnection.returnResultSetSelectStatement(sql, 1, ch);

        List<String> tiposPratos = new ArrayList<String>();
        try {
            while(ch.r.next()) {
                String tipoPrato = ch.r.getString("descricao");
                tiposPratos.add(tipoPrato);
            }
            ch.r.close();
        } catch (SQLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        dbConnection.closeDatabase();

        return tiposPratos.toArray(new String[0]);
    }

	
}
